//
#pragma once

#include <core/types.h>

#define ATAG_NONE	0x00000000

struct TagHeader
{
	UINT32 nSize;
	UINT32 ulTag;
};

#define ATAG_CORE	0x54410001

struct TagCore
{
	UINT32 ulFlags;	
	UINT32 nPageSize;
	UINT32 ulRootDev;
};

#define ATAG_MEM	0x54410002

struct TagMem32
{
	UINT32	nSize;
	UINT32	ulStart;
};

#define ATAG_VIDEOTEXT	0x54410003

struct TagVideoText
{
	BYTE		bX;
	BYTE		bY;
	UINT16		usVideoPage;
	BYTE		bVideoMode;
	BYTE		bVideoCols;
	UINT16		usVideoEgaBx;
	BYTE		bVideoLines;
	BYTE		bVideoIsVGA;
	UINT16		usVideoPoints;
};

#define ATAG_RAMDISK   0x54410004

struct TagRamDisk
{
	UINT32 dwFlags;
	UINT32 nSize;
	UINT32 nStart;
};

#define ATAG_INITRD	   0x54410005
#define ATAG_INITRD2   0x54420005

struct TagInitrd
{
	UINT32 ulStart;
	UINT32 nSize;
};

#define ATAG_SERIAL    0x54410006

struct TagSerialnr
{
	UINT32 ulLow;
	UINT32 ulHigh;
};

#define ATAG_REVISION   0x54410007

struct TagRevision
{
	UINT32 ulRev;
};

#define ATAG_VIDEOLFB   0x54410008

struct TagVideolfb
{
	UINT16		usLfbWidth;
	UINT16		usLfbHeight;
	UINT16		usLfbDepth;
	UINT16		usLfbLineLength;
	UINT32		ulLfbBase;
	UINT32		nLfbSize;
	BYTE		bRedSize;
	BYTE		bRedPos;
	BYTE		bGreenSize;
	BYTE		bGreenPos;
	BYTE		bBlueSize;
	BYTE		bBluePos;
	BYTE		bRsvdSize;
	BYTE		bRsvdPos;
};

#define ATAG_CMDLINE    0x54410009

struct TagCmdline
{
	char	cCmdLine[1];
};


#define ATAG_MEMCLK     0x41000402

struct TagMemClk
{
	UINT32 ulFMemClk;
};

struct Atag
{
	struct TagHeader stHdr;

	union
	{
		struct TagCore		stCore;
		struct TagMem32		stMem;
		struct TagVideoText	stVideoText;
		struct TagRamDisk	stRamDisk;
		struct TagInitrd	stInitRd;
		struct TagSerialnr	stSerialNr;
		struct TagRevision	stRevision;
		struct TagVideolfb	stVideoLfb;
		struct TagCmdline	stCmdLine;
	};
};


#define TAG_NEXT(t)	((struct Atag *)((UINT32 *)(t) + (t)->stHdr.nSize))
#define TAG_SIZE(type)	((sizeof(struct TagHeader) + sizeof(struct type)) >> 2)

#if 1
#define FOR_EACH_TAG(t, base) \
	for (t = base; t->stHdr.nSize; t = TAG_NEXT(t))
#endif


#define CONF_RAM_BANK_NUM        1
#define DEFAULT_KCMDLINE_LEN     1024

